import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path"; //这个path用到了上面安装的@types/node

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  // server: {
  //   host: "192.168.0.106", // 本机的局域网IP
  //   port: 8080, // 端口号，一般情况下为8080
  // },
  //这里进行配置别名
  resolve: {
    alias: {
      "@": path.resolve("./src"), // @代替src
    },
  },
  server: {
    //本地服务
    proxy: {
      //代理
      "/network": {
        target: "https://192.168.1.4:8080",
        changeOrigin: true,
      },
      "/local": {
        target: "http://localhost:3003",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/local/, ""), //路径重写
      },
    },
  },
});
